{% extends "index.html" %}
<link rel="StyleSheet" href="media/css/table.css" type="text/css">
{% block ip_content %}

	<div id="container">
		<div id="kutubaslik"><strong>Sistemdeki Yüklü Kurallar</strong></div>	
			<br/>
			<br/>
			<br/>
		<div id="leftcolumn">
			{% if not chain %}
			Kategori :<select name="orderman">
  				<option value ="chain">Zincir</option>
  				<option value ="target">Hedef</option>
  				<option value ="name">İsim</option>
  				
			</select>
			{% endif %}
			{% if chain %}
			Kategori :<select name="loadman">
				{% for c in chain %}
  				<option value ="{{c.id}}">{{c.name}}</option>
  				{% endfor %}
			</select>
			{% endif %}		
		</div>

		<div id="rightcolumn">
			{% if not chain %}
			<button onclick="rule_kategori(document.getElementsByName('orderman'))"><img src="media/images/go.gif" width="15" height="15"/></button>
			{% endif %}	
			{% if chain %}
			<button onclick="rule_load(document.getElementsByName('loadman'))"><img src="media/images/go.gif" width="15" height="15"/></button>
			{% endif %}
		</div>
	
	</div>

	<br/>	
	<br/>
	<br/>
	<br/>
	

	<div id="itsthetable" align="center">
		<table summary="Submitted table designs" >
			<caption>Kurallar</caption>
			<thead>
				<tr>
					<th scope="col">Isim</th>
					<th scope="col">Zincir</th>

					<th scope="col">Ozellikler</th>
					<th scope="col">Heder</th>
					<th scope="col">Yuklu</th>
					<th scope="col">Sil</th>
					{% if chain %}
						<th scope="col">Sıra</th>
					{% endif %}
				</tr>
			</thead>	
			
			<tbody>
			{% if object_list %}
				{% for rule in object_list %}				
					<tr >
					<th scope="row"><a href="/iptables/rule/{{rule.parent_rule.id}}">{{rule.parent_rule.name}}</a></th>
					<td>{{rule.parent_rule.parent_chain.name}}</td>

					<td>
						
						
						{% if rule.parent_rule.tcp_set.count %}
						<span align="left">
						<a href="/iptables/rule/{{rule.parent_rule.id}}/edit/tcp/">TCP</a>
						<a href="/iptables/rule/tcp/{{rule.parent_rule.id}}/delete/"><img src="media/images/delete.gif" width="15px" height="15px"></a>
						</span>
						<br/>
						{% endif %}
						
						{% if rule.parent_rule.udp_set.count %}
						<span align="left">
						<a href="/iptables/rule/{{rule.parent_rule.id}}/edit/udp/">UDP</a>
						<a href="/iptables/rule/udp/{{rule.parent_rule.id}}/delete/"><img src="media/images/delete.gif" width="15px" height="15px"></a>
						</span>
						<br/>
						{% endif %}
						
							
						
						{% if rule.parent_rule.optional_set.count %}
						<span align="left">
						<a href="/iptables/rule/{{rule.parent_rule.id}}/edit/extra/">EXT</a>
						<a href="/iptables/rule/extra/{{rule.parent_rule.id}}/delete/"><img src="media/images/delete.gif" width="15px" height="15px"></a>
						</span>
						<br/>
						{% endif %}

						{% if rule.parent_rule.icmp_set.count %}
						<span align="left">
						<a href="/iptables/rule/{{rule.parent_rule.id}}/edit/icmp/">ICM</a>
						<a href="/iptables/rule/icmp/{{rule.parent_rule.id}}/delete/"><img src="media/images/delete.gif" width="15px" height="15px"></a>
						</span>
						<br/>
						{% endif %}

						{% if rule.parent_rule.prefixer_set.count %}
						<span align="left">
						<a href="/iptables/rule/{{rule.parent_rule.id}}/edit/prefix/">Log</a>
						<a href="/iptables/rule/prefix/{{rule.parent_rule.id}}/delete/"><img src="media/images/delete.gif" width="15px" height="15px"></a>
						
						</span>
						<br/>
						{% endif %}

												
					</td>
					<td>{{rule.parent_rule.parent_target.name}}</td>
					<td>
					
					{% if rule.parent_rule.loaded %}

					{% if chain %}
					<form method="post" action="/iptables/rule/unload/">
						<input type="hidden" name="loader" value="{{ rule.parent_rule.id }}" />
						<input type="hidden" name="chain" value="{{ rule.parent_rule.parent_chain.id }}" 
						/>
						<button type="submit"><img src="media/images/load.jpg" width="25" height="25"/> </button>
					</form>
					{% endif %}

					{% if not chain %}
						EVET
					{% endif %}

					{% endif %}


					{% if not rule.parent_rule.loaded %}
					
					{% if chain %}
					<form method="post" action="/iptables/rule/load/">
						<input type="hidden" name="loader" value="{{ rule.parent_rule.id }}" />
						<input type="hidden" name="chain" value="{{ rule.parent_rule.parent_chain.id }}" />
						<button type="submit"><img src="media/images/unload.jpg" width="25" height="25"/> </button>
					</form>
					{% endif %}
					
					{% if not chain %}
						HAYIR
					{% endif %}
					
						
					{% endif %}
					</td>
					<td><a href="/iptables/rule/{{rule.parent_rule.id}}/delete/">
					<img src="media/images/trash.gif" width="40px" height="40px"></a></td>
				
					{% if chain %}
						<td>
							{% if not forloop.first %}
								<form method="post" action="/iptables/rule/up/">
									
									<input type="hidden" name="rule_id" value="{{ rule.parent_rule.id }}" />
									<input type="hidden" name="chain" value="{{ rule.parent_rule.parent_chain.id }}" />
									<button type="submit"><img src="media/images/up.png" width="15" height="15"/> </button>
								
								</form>
							{% endif %}
							
							{% if not forloop.last %}
								<form method="post" action="/iptables/rule/down/">
									
									<input type="hidden" name="rule_id" value="{{ rule.parent_rule.id }}" />
									<input type="hidden" name="chain" value="{{ rule.parent_rule.parent_chain.id }}" />
									<button type="submit"><img src="media/images/down.png" width="15" height="15"/> </button>
								
								</form>
							{% endif %}
						</td>
					{% endif %}
				</tr>
				{% endfor %}
			{% endif %}
</tbody>

</table> 
	<div id="container">
		{% if has_previous %}
			<div id="leftcolumn"><a href="?page={{previous}}">Onceki</a></div>
		{% endif %}

		{% if has_next %}
		<div id="rightcolumn"><a href="?page={{next}}">Sonraki</a></div>
		{% endif %}

	</div >


{% endblock %} 
